//
//  MMember.m
//  RRQS
//
//  Created by kyjun on 16/3/28.
//
//

#import "MMember.h"

@implementation MMember


-(instancetype)initWithItem:(NSDictionary *)item{
    self = [super init];
    if(self){
        self.userID = [item objectForKey:@"uid"];
        self.realName = [item objectForKey:@"realname"];
        self.password = [item objectForKey:@"pass"];
        self.phone = [item objectForKey:@"phone"];
        self.close = [item objectForKey:@"close"];
        self.account = [item objectForKey:@"account"];
        self.lat = [item objectForKey:@"lat"];
        self.lng = [item objectForKey:@"lng"];
        self.bankName = [item objectForKey:@"bank_name"];
        self.bankCard = [item objectForKey:@"bank"];
    }
    return self;
}

- (id)initWithCoder:(NSCoder *)aDecoder
{
    self = [super init];
    if (self) {
        self.userID = [aDecoder decodeObjectForKey:@"userID"];
        self.realName = [aDecoder decodeObjectForKey:@"realName"];
        self.password = [aDecoder decodeObjectForKey:@"password"];
        self.phone = [aDecoder decodeObjectForKey:@"phone"];
        self.close = [aDecoder decodeObjectForKey:@"close"];
        self.account = [aDecoder decodeObjectForKey:@"account"];
         self.lat = [aDecoder decodeObjectForKey:@"lat"];
        self.lng = [aDecoder decodeObjectForKey:@"lng"];
        self.bankName = [aDecoder decodeObjectForKey:@"bankName"];
        self.bankCard = [aDecoder decodeObjectForKey:@"bankCard"];
        self.isLogin = [[aDecoder decodeObjectForKey:@"isLogin"] boolValue];
        return self;
    }else{
        return nil;
    }
}

- (void)encodeWithCoder:(NSCoder *)aCoder
{
    [aCoder encodeObject:self.userID forKey:@"userID"];
    [aCoder encodeObject:self.realName forKey:@"realName"];
    [aCoder encodeObject:self.password forKey:@"password"];
    [aCoder encodeObject:self.phone forKey:@"phone"];
    [aCoder encodeObject:self.close forKey:@"close"];
    [aCoder encodeObject:self.account forKey:@"account"];
    [aCoder encodeObject:self.lat forKey:@"lat"];
    [aCoder encodeObject:self.lng forKey:@"lng"];
    [aCoder encodeObject:self.bankName forKey:@"bankName"];
    [aCoder encodeObject:self.bankCard forKey:@"bankCard"];
    [aCoder encodeObject:[NSNumber numberWithBool:self.isLogin] forKey:@"isLogin"];
    
}



@end
